import 'package:casdon/core/network/api_client_provider.dart';
import 'package:casdon/modules/lifeCircle/application/notification/life_banner_list_notifier.dart';
import 'package:casdon/modules/lifeCircle/application/notification/life_tab_controller_notifier.dart';
import 'package:casdon/modules/lifeCircle/application/notification/life_topic_list_notifier.dart';
import 'package:casdon/modules/lifeCircle/application/notification/life_topic_comment_list_notifier.dart';
import 'package:casdon/modules/lifeCircle/application/notification/topic_flow_list_notifier.dart';
import 'package:casdon/modules/lifeCircle/application/notification/topic_recomend_list_notifier.dart';
import 'package:casdon/modules/lifeCircle/data/repository/life_repository_impl.dart';
import 'package:casdon/modules/lifeCircle/domain/states/life_banner_list_state.dart';
import 'package:casdon/modules/lifeCircle/domain/states/life_tab_state.dart';
import 'package:casdon/modules/lifeCircle/domain/states/life_topic_list_state.dart';
import 'package:casdon/modules/lifeCircle/domain/states/life_topic_comment_list_state.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_banner_list_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_del_comment_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_del_topic_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_subject_list_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_topic_add_comment_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_topic_detail_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_topic_list_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_comment_reply_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/life_topic_comment_list_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/topic_flow_list_usecase.dart';
import 'package:casdon/modules/lifeCircle/domain/usecase/topic_recommend_list_usecase.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

// final lifeTabControllerProvider = StateProvider<TabController?>((ref) => null);

// 生活圈api仓库
final lifeRepository = Provider(
  (ref) => LifeRepositoryImpl(apiClient: ref.read(apiClientProvider)),
);

// usecase
final lifeBannerListUsecaseProvider = Provider(
  (ref) => LifeBannerListUsecase(ref.read(lifeRepository)),
);

// 生活圈 话题板块 列表。分2类，type = 1， type = 0
final lifeSujectListUsecaseProvider = Provider(
  (ref) => LifeSubjectListUsecase(ref.read(lifeRepository)),
);

// 生活圈 话题内容列表
final lifeTopicListUsecaseProvider = Provider(
  (ref) => LifeTopicListUsecase(ref.read(lifeRepository)),
);

// 生活圈 帖子详情
final lifeTopicDetailUsecaseProvider = Provider(
  (ref) => LifeTopicDetailUsecase(ref.read(lifeRepository)),
);

// 评论回复列表
final lifeCommentReplyUsecaseProvider = Provider(
  (ref) => LifeCommentReplyUsecase(ref.read(lifeRepository)),
);

// 生活圈 评论列表
final lifeTopicCommentListUsecaseProvider = Provider(
  (ref) => LifeTopicCommentListUsecase(ref.read(lifeRepository)),
);

// 生活圈 评论/回复
final lifeTopicAddCommentUsecaseProvider = Provider(
  (ref) => LifeTopicAddCommentUsecase(ref.read(lifeRepository)),
);

// 生活圈 删除帖子
final lifeDelTopicUsecaseProvider = Provider(
  (ref) => LifeDelTopicUsecase(ref.read(lifeRepository)),
);

// 生活圈 删除评论
final lifeDelCommentUsecaseProvider = Provider(
  (ref) => LifeDelCommentUsecase(ref.read(lifeRepository)),
);

// 生活圈 话题内容 推荐列表
final topicRecommendListUsecaseProvider = Provider(
  (ref) => TopicRecommendListUsecase(ref.read(lifeRepository)),
);

// 生活圈 话题内容 关注列表
final topicFlowListUsecaseProvider = Provider(
  (ref) => TopicFlowListUsecase(ref.read(lifeRepository)),
);

// notifier
final lifeBannerListNotifierProvider =
    AsyncNotifierProvider<LifeBannerListNotifier, LifeBannerListState>(
      () => LifeBannerListNotifier(),
    );

final lifeTabControllerNotifierProvider =
    AsyncNotifierProvider<LifeTabControllerNotifier, LifeTabState>(
      () => LifeTabControllerNotifier(),
    );

final lifeTopicListNotifierProvider =
    AsyncNotifierProviderFamily<
      LifeTopicListNotifier,
      LifeTopicListState,
      String
    >(() => LifeTopicListNotifier());

final topicRecommendListNotifierProvider =
    AsyncNotifierProvider<TopicRecomendListNotifier, LifeTopicListState>(
      () => TopicRecomendListNotifier(),
    );

final topicFlowListNotifierProvider =
    AsyncNotifierProvider<TopicFlowListNotifier, LifeTopicListState>(
      () => TopicFlowListNotifier(),
    );

final lifeTopicCommentListNotifierProvider =
    AsyncNotifierProviderFamily<
      LifeTopicCommentListNotifier,
      LifeTopicCommentListState,
      String
    >(() => LifeTopicCommentListNotifier());
